// ingest 仿真
POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      { "split": {"field":"tags", "separator":","} },
      { "trim": {"field":"tags"} },
      { "set": {"field": "views", "value": 0}}
    ]
  },
  "docs": [
    { "_source": { "tags": "ab, cv"}}
  ]
}

// 新建 ingest
PUT _ingest/pipeline/test_pipeline
{
    "description": "test_pipeline",
    "processors": [
      { "split": {"field":"tags", "separator":","} },
      { "trim": {"field":"tags"} },
      { "set": {"field": "views", "value": 0}}
    ]
}

// 查看pipeline
GET _ingest/pipeline/test_pipeline

// 删除pipeline
delete _ingest/pipeline/test_pipeline

// 仿真具体的pipeline
POST _ingest/pipeline/test_pipeline/_simulate
{
    "docs": [
        {
            "_source": {
                "tags": "ab, cv"
            }
        }
    ]
}

// 如果存在test_blog就删除, 不存在跳过
delete /test_blogs

// 不使用pipeline更新数据
PUT /test_blogs/_doc/1
{
    "content": "hello",
    "tags": "ab, cv"
}

// 使用pipeline更新数据
PUT /test_blogs/_doc/2?pipeline=test_pipeline
{
    "content": "hello",
    "tags": "ab, cv"
}

// 查看数据, 一条处理了, 一条未处理
get /test_blogs/_search

get /test_blogs

// _update_by_query 会导致错误, 虽然报错, 但是我测试, 实际是 更新了的
post /test_blogs/_update_by_query?pipeline=test_pipeline

// 增加条件
post /test_blogs/_update_by_query?pipeline=test_pipeline
{
  "query": {
    "bool": {
      "must_not": {
        "exists": {
          "field":"views"
        }
      }
    }
  }
}